Skip to main content
Version: 12.10.0

How to do certain things

ktlint

To run the gradle task in Android Studio
<module_name>->formatting->ktlintFormat

To format using ktlint
./gradlew <module_name>:ktlintFormat

To verify ktlint fixes
./gradlew <module_name>:ktlint

To run ktlint for all modules in plugin repo, you can run the following script. Same task runs in pipeline
./script/run-unit-test.sh

Detekt

To run detekt
./gradlew <module_name>:detetkt

Unit Test

To get the unit test reports for a module
./gradlew <module_name>:testDebugUnitTest

To run unit test for all modules
./script/ktlint-run.sh

To get the unit test coverage for a module
./gradlew <module_name>:jacocoUnitTestReport

Snapshot Testing

To create the reference images for snapshot testing
./gradlew <module_name>:recordPaparazziDebug

To verify the reference image
./gradlew <module_name>:verifyPaparazziDebug

Dokka

To run the documentation using dokka
./gradlew dokkaHtml
./gradlew dokkaJavadoc

Advanced Tips

To run two commands at once, for example detekt and unit test for a module

To run in sequence
./gradlew <module_name>:detetkt <module_name>:testDebugUnitTest

To run in parallel
./gradlew <module_name>:detetkt <module_name>:testDebugUnitTest --parallel

Upload/Publish Artifacts

This is applicable only for Open Contract module.

To upload/publish open contract to Azure artifacts.